from email.policy import strict
import requests
from lxml import etree
import os
import stat
import urllib.request
import sys
from seed import main


class Down:
    def __init__(self, url):
        self.url = url
        self.headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36'
        }
        res = self.common_get(self.url)
        self.handle_res(res)

    def common_get(self, url):
        res = requests.get(url, headers=self.headers)
        res.encoding = "utf8"
        response = etree.HTML(res.text)
        return response

    def handle_res(self, res):
        print(res)
        lis = res.xpath('//div[@class="carousel-inner"]/div')
        for item in lis:
            resText = item.xpath('.//div[@class="fp-one-cita"]/a/text()')[0]
            print(resText)
            # main(1,resText)


url = 'http://wufazhuce.com/'
Down(url)

